#include <stdio.h>
#include <mpi.h>
int main(int argc, char* argv[])
{
	int size, rank, num, ret;
	MPI_Comm comm = MPI_COMM_WORLD;
	MPI_Init(&argc, &argv);
	MPI_Comm_size(comm, &size);
	MPI_Comm_rank(comm, &rank);
	num = rank;
	MPI_Reduce(&num, &ret, 1, MPI_INT, MPI_MAX, 0, comm);
	if(rank == 0)
		printf("max of process id %d\n", ret);
	MPI_Finalize();
	return 0;
}